package com.xsx.service.impl;

import com.xsx.dao.UserDao;
import com.xsx.dao.impl.UserDaoImpl;
import com.xsx.pojo.User;
import com.xsx.service.UserService;

public class UserServiceImpl  implements UserService {
    private UserDao userDao =new UserDaoImpl();

    @Override
    public void registUser(User user) {
     userDao.saveUser(user);
    }

    @Override
    public User login(User user) {
       return userDao.queryUserByUsernameAndPassword(user.getUsername(),user.getPassword());
    }

    @Override
    public boolean existsUserName(String username) {
        if (userDao.queryUserByUsername(username)==null)
        {
            return false;
        }
        return true;
    }
}
